package com.dfrobot.controller;

import com.dfrobot.domain.entity.Brand;
import com.dfrobot.service.HelloService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
//@RequestMapping一个用来处理请求地址映射的注解，可用于类或方法上，用于类上，表示类中的所有相应请求的方法都是该地址作为父路径
@RequestMapping(value = "/brand", produces = "application/json;charset=UTF-8")

public class Hello {
    private HelloService  helloService;

    /*public static void main(String[] args) {
        System.out.println("Hello world");

    }*/

    @GetMapping("/list")
    public List<Brand> getBrandssList(){
        List<Brand>  brandList;
        brandList = this.helloService.getBrandList();
        System.out.println("执行完成");
        return brandList;
    }

    @GetMapping("/find/{id}")
    public List<Brand> getLimitBrand(@PathVariable int id ){
        List<Brand> brandList;
        brandList = this.helloService.getBrandSelect(id);
        return brandList;
    }
}
